(function(){
    'use strict';

    var app = angular.module('myApp.home-module');
    
    app.controller( 'MenuController', [ '$rootScope', '$scope', 'Auth', 'Storage', 
                                        	function( $rootScope, $scope, Auth, Storage ){	
    	$scope.projectName = 'Angular';
    	$scope.tab = 'home';
    	
    	$scope.$on( '$routeChangeStart', function( event, next, prev ){
    		if( next.tab ) $scope.tab = next.tab;
    	} );
    	
    	$scope.logout = function(){
    		Auth.logout( function(){
    			Storage.remove( 'user' );
    			$rootScope.user = undefined;
    		} );
    	}
    	
    } ] );

})();